﻿@using ECG.Common
@using ECG.Utility
@using ECG.WebUI.CustomHelpers
@using ECG.WebUI.Models
@model IEnumerable<ProductByCateTopListPagingDto>
<!--Ta ca SAN PHAM-->
@if(Model.Any())
{
    <div class="bb_product_most bb_p_m_paddTop">
        <div class="bb_p_m_headerv2">
            <span class="babo-icon-category bb_p_m_tcsp">
                <span class="bb_p_m_txt1">SẢN PHẨM<br /></span>
                <span class="bb_p_m_txt2">MỚI NHẤT</span>                           
            </span>
        </div>
        <div class="bb_p_m_body">
    
            <ul class="bb_pro_cate bb_product_list">
                @foreach (var item in Model)
                {
                    var pDetailLink = Url.Action("Index", "ProductDetail", new { productId = item.Id, productName = StringUtil.RemoveSpecialCharactersVn(item.Name) });
                    //var productStatus = string.Empty;
                    decimal rootPrice = item.Price;
                    decimal price = item.GetPricePromotion();
                    <li class="bb_p_item_margin">
                        <div class="bb_p_item">
                            <span class="icon-productNew-small"></span>
                            <a href="@pDetailLink" class="bb_lnk_name">
                                <div class="bb_p_img">
                                    <img src="@item.ImagePath.ImagePathThumb(168,168)" width="168" height="168" alt="@item.Name" class="img-loading" />
                                </div>
                                <div class="bb_p_name">
                                    <h3>@item.Name </h3>
                                    <span class="bb_p_name_txt1"></span><br />
                                    <span class="bb_p_name_txt2">@item.ProviderName</span>
                                </div>
                                <div class="bb_p_price">
                                    @if(price > 0)
                                    {
                                        <span class="bb_p_priceCurrent">
                                            @price.ToString("##,###") <span class="bb_p_normal_txt">VNĐ</span>
                                            @*<i class="babo-icon-special bb_p_icon_buy" title="Số lượt thanh toán"></i>*@
                                        </span>
                                        <span class="bb_p_priceOld">
                                            <span class="bb_p_priOld_left">
                                                @rootPrice.ToString("##,###") VNĐ
                                            </span>
                                            <span class="bb_p_cusBuy">
                                            </span>
                                            <span class="clr"></span>
                                        </span>
                                    }
                                    else
                                    {
                                        <span class="bb_p_priceCurrent">
                                            @rootPrice.ToString("#,###") <span class="bb_p_normal_txt">VNĐ</span>
                                            @*<i class="babo-icon-special bb_p_icon_buy" title="Số lượt thanh toán"></i>*@
                                        </span>
                                        <span class="bb_p_priceOld">
                                            <span class="bb_p_priOld_left">
                                            </span>
                                            <span class="bb_p_cusBuy">
                                            </span>
                                            <span class="clr"></span>
                                        </span>
                                    }
                                </div>
                            </a>               
                        </div>
                    </li>
                }
            </ul>
            
            <div class="clr"></div>
        </div>
                            
        <!--PHAN TRANG SAN PHAM-->
                            
        <div class="bb_pagging">
              @Html.PageLinksOnProductListCatePage((PageInfo)ViewBag.PageInfo, i => Url.Action("Index", "ProductNew", new { page = i } ))
        </div>
        <!--END PHAN TRANG SAN PHAM-->
    </div>
    <!--End tat ca San pham SAN PHAM-->
}